require(['./config'],()=>{
    require(['header','footer','jquery'],()=>{
        class Finish{
            constructor(){
                this.finish()   
            }
            finish(){
                let cart = localStorage.getItem('cart')
                cart = JSON.parse(cart)
                console.log(cart)
                const allMoney = cart.reduce((money,shop)=>{
                    if(shop.check) money+=shop.price*shop.count
                    //无论条件是否满足都要写return
                    return money
                },0)
                $('#finish').html(allMoney.toFixed(2))
            }
        }
        new Finish()
    })
})